package com.zzti.contril;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.zzti.Dao.EmployeeDao;
import com.zzti.Thired.Employee;
import com.zzti.Thired.User;
import com.zzti.impl.EmployeeDaoimpl;

/**
 * Servlet implementation class EmployeeServlet
 */
public class EmployeeServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
   
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		List<Employee> list=new ArrayList<Employee>();
		EmployeeDao ed=new EmployeeDaoimpl();
		list=ed.getAll();
		if(list!=null) {
			HttpSession session=request.getSession();
			session.setAttribute("list", list);
			request.getRequestDispatcher("showEmployee.jsp").forward(request, response);
		}else {
			System.out.print("鵽");
		}
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}